package com.ruoyi.common.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @Description: TODO
 * @Author ONESTAR
 * @Date: 2021/10/21 14:37
 * @Version 1.0
 */
@Component
public class PwdConfig {

    /**
     * 是否检测密码口令长度标识
     */
    public static String CHECK_PASSWORD_LENGTH;

    /**
     * 密码最小长度，默认为8

     */

    public static String MIN_LENGTH;

    /**
     * 密码最大长度，默认为20
     */

    public static String MAX_LENGTH;

    /**
     * 是否包含数字
     */

    public static String CHECK_CONTAIN_DIGIT;

    /**
     * 是否区分大小写
     */

    public static String CHECK_DISTINGGUISH_CASE;

    /**
     * 是否包含小写字母
     */

    public static String CHECK_LOWER_CASE;

    /**
     * 是否包含大写字母
     */

    public static String CHECK_UPPER_CASE;

    /**
     * 是否包含特殊符号
     */

    public static String CHECK_CONTAIN_SPECIAL_CHAR;

    /**
     * 特殊符号集合
     */
    public static String DEFAULT_SPECIAL_CHAR="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";

    public static String SPECIAL_CHAR;

    /**
     * 是否检测键盘按键横向连续
     */

    public static String CHECK_HORIZONTAL_KEY_SEQUENTIAL;

    /**
     * 键盘物理位置横向不允许最小的连续个数
     */
    public static String LIMIT_HORIZONTAL_NUM_KEY;

    /**
     * 是否检测键盘按键斜向连续
     */
    public static String CHECK_SLOPE_KEY_SEQUENTIAL;

    /**
     * 键盘物理位置斜向不允许最小的连续个数
     */

    public static String LIMIT_SLOPE_NUM_KEY;

    /**
     * 是否检测逻辑位置连续
     */

    public static String CHECK_LOGIC_SEQUENTIAL;

    /**
     * 密码口令中字符在逻辑位置上不允许最小的连续个数
     */

    public static String LIMIT_LOGIC_NUM_CHAR;

    /**
     * 是否检测连续字符相同
     */

    public static String CHECK_SEQUENTIAL_CHAR_SAME;

    /**
     * 密码口令中相同字符不允许最小的连续个数
     */
    public static String LIMIT_NUM_SAME_CHAR;

    /**
     * 键盘横向方向规则
     */
    public static String[] KEYBOARD_HORIZONTAL_ARR = {
            "01234567890",
            "qwertyuiop",
            "asdfghjkl",
            "zxcvbnm",
    };

    /**
     * 键盘斜线方向规则
     */
    public static String[] KEYBOARD_SLOPE_ARR = {
            "1qaz",
            "2wsx",
            "3edc",
            "4rfv",
            "5tgb",
            "6yhn",
            "7ujm",
            "8ik,",
            "9ol.",
            "0p;/",
            "=[;.",
            "-pl,",
            "0okm",
            "9ijn",
            "8uhb",
            "7ygv",
            "6tfc",
            "5rdx",
            "4esz"
    };

    @Value("${pwd.checkPasswordLength}")
    public void setCheckPasswordLength(String checkPasswordLength) {
        CHECK_PASSWORD_LENGTH = checkPasswordLength;
    }

    @Value("${pwd.limitPassMinLength}")
    public void setMinLength(String minLength) {
        MIN_LENGTH = minLength;
    }

    @Value("${pwd.limitPassMaxLength}")
    public void setMaxLength(String maxLength) {
        MAX_LENGTH = maxLength;
    }

    @Value("${pwd.checkContainDigit}")
    public void setCheckContainDigit(String checkContainDigit) {
        CHECK_CONTAIN_DIGIT = checkContainDigit;
    }

    @Value("${pwd.checkContainUpperLowerCase}")
    public void setCheckDistingguishCase(String checkDistingguishCase) {
        CHECK_DISTINGGUISH_CASE = checkDistingguishCase;
    }

    @Value("${pwd.checkContainLowerCase}")
    public void setCheckLowerCase(String checkLowerCase) {
        CHECK_LOWER_CASE = checkLowerCase;
    }

    @Value("${pwd.checkContainUpperCase}")
    public void setCheckUpperCase(String checkUpperCase) {
        CHECK_UPPER_CASE = checkUpperCase;
    }


    @Value("${pwd.checkContainSpecialChar}")
    public void setCheckContainSpecialChar(String checkContainSpecialChar) {
        CHECK_CONTAIN_SPECIAL_CHAR = checkContainSpecialChar;
    }

    public void setSpecialChar(String specialChar) {
        SPECIAL_CHAR = specialChar;
    }

    @Value("${pwd.checkContainSpecialChar}")
    public void setCheckHorizontalKeySequential(String checkHorizontalKeySequential) {
        CHECK_HORIZONTAL_KEY_SEQUENTIAL = checkHorizontalKeySequential;
    }

    @Value("${pwd.checkContainSpecialChar}")
    public void setLimitHorizontalNumKey(String limitHorizontalNumKey) {
        LIMIT_HORIZONTAL_NUM_KEY = limitHorizontalNumKey;
    }

    @Value("${pwd.checkSlopeKeySequential}")
    public void setCheckSlopeKeySequential(String checkSlopeKeySequential) {
        CHECK_SLOPE_KEY_SEQUENTIAL = checkSlopeKeySequential;
    }

    @Value("${pwd.slopeKeyLimitNum}")
    public void setLimitSlopeNumKey(String limitSlopeNumKey) {
        LIMIT_SLOPE_NUM_KEY = limitSlopeNumKey;
    }

    @Value("${pwd.checkLogicSequential}")
    public void setCheckLogicSequential(String checkLogicSequential) {
        CHECK_LOGIC_SEQUENTIAL = checkLogicSequential;
    }

    @Value("${pwd.logicLimitNum}")
    public void setLimitLogicNumChar(String limitLogicNumChar) {
        LIMIT_LOGIC_NUM_CHAR = limitLogicNumChar;
    }

    @Value("${pwd.checkSequentialCharSame}")
    public void setCheckSequentialCharSame(String checkSequentialCharSame) {
        CHECK_SEQUENTIAL_CHAR_SAME = checkSequentialCharSame;
    }

    @Value("${pwd.sequentialCharNum}")
    public void setLimitNumSameChar(String limitNumSameChar) {
        LIMIT_NUM_SAME_CHAR = limitNumSameChar;
    }
}
